package com.hermes.common.util;

import com.hermes.biz.common.util.string.StringUtil;

import javax.servlet.ServletRequest;

import org.apache.struts2.ServletActionContext;


public class ParameterParserUtil {

	public static String getParameter(String parameterName){
		 
		ServletRequest request=ServletActionContext.getRequest(); 
		
	    String result  = request.getParameter(parameterName); 	
	     
	    if(StringUtil.isNotBlank(result)){
	    	return result;
	    }
		
		return "";
	}
	
	public static String getUserIpAddress(){
		 
		ServletRequest request=ServletActionContext.getRequest(); 
		
	    String result  = request.getRemoteAddr(); 	
	     
	    if(StringUtil.isNotBlank(result)){
	    	return result;
	    }
		return "unknow";
	}
}
